<?php
session_start();

if (isset($_SESSION['userid'])) {
    if (isset($_GET["page"]))
        $page_id = $_GET["page"];
    else
        $page_id = 0;
}
else
    $page_id = -1;
//header('Location: index.php?page='.$page_id);
if (!isset($_SESSION['userid']) && (!isset($_GET['page'])))
    header('Location: index.php?page=-1');
if (isset($_SESSION['userid']) && (isset($_GET['page'])) && ($_GET['page'] == "-1"))
    header('Location: index.php');
?>
<!DOCTYPE html>
<html manifest="friendpp.appcache">
    <head>
        <title>Friend++ - 寻找你我身边志同道合的朋友</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="initial-scale=1, user-scalable=no"/>

        <!--Enable native-app style-->
        <meta name="apple-mobile-web-app-capable" content="yes">
        <link rel="stylesheet" href="./jquery/jquery.mobile-1.0b1.min.css" />
        <link rel="stylesheet" href="css/index.css"/>
        <link rel="stylesheet" href="css/chat.css"/>
        <link rel="stylesheet" href="css/base.css"/>

        <script src="./jquery/jquery-1.6.1.min.js" type="text/javascript"></script>
        <script src="./jquery/jquery.mobile-1.0b1.min.js" type="text/javascript"></script>
        <script src="./js/main.js" type="text/javascript"></script>
        <!--李本卿  2011-7-8-->
        <script src="./js/profile.js" ></script>

    </head>
    <body>
        <div id="main_page" data-role="page">
            <div data-role="header" data-theme="b" data-backbtn="false"  data-position="fixed" id="index_header">
                <a id="refresh_button" data-role="button" data-icon="refresh" href="" >刷新</a>
                <h2>Friend++</h2>

                <!--                <a id="prev_button" data-role="button" data-icon="arrow-l">上一页</a>
                                <a id="next_button" data-role="button" data-icon="arrow-r" class="ui-btn-right">下一页</a>-->

                <a id="edit_button" data-role="button" data-icon="gear" class="ui-btn-right">编辑</a>
                <!--                <a id="cancel_button" data-role="button" data-icon="delete" class="ui-btn-right">取消</a>-->
                <div id="nav_bar" data-role="navbar">
                    <ul>
                        <li><a id="main_tab" href="" <?php if ($page_id == 0)
    echo 'class="ui-btn-active"' ?>>周围的人</a></li>
                        <li><a id="friend_tab" href=""<?php if ($page_id == 1)
                               echo 'class="ui-btn-active"' ?>>好友状态</a></li>
                        <li><a id="mine_tab" href=""<?php if ($page_id == 2)
                               echo 'class="ui-btn-active"' ?>>我的主页</a></li>
                    </ul>
                </div>

            </div>

            <div data-role="header" data-theme="b" data-backbtn="false" data-position="fixed" id="welcome_header">
                <p class="l-title">Friend++</p>

            </div>

            <div id="welcome_content" data-role="content" class="l-content l-friend l-inset-content ">

                <ul data-role="listview" class="l-list-smallpad" data-dividertheme="e" data-inset="true">
                    <li>这些用户正在使用Friends++：</li>
                    <li>
                        <div class="ui-grid-b">



                            <div class="ui-block-c">
                                <div class="l-people" id="random_people_1">
                                    <a>
                                        <div class="l-avatar l-shadowbox" style="background-image:url('images/Mooner.jpg')">
                                            <div class="l-status">
                                                <img src="images/online.png"/>
                                                <p>&infin;</p>
                                            </div>
                                            <h4>Mooner</h4>
                                        </div>
                                    </a>
                                </div>
                            </div>

                            <div class="ui-block-b">
                                <div class="l-people" id="random_people_0">
                                    <a>
                                        <div class="l-avatar l-shadowbox" style="background-image:url('images/Ellic.png')">
                                            <div class="l-status">
                                                <img src="images/online.png"/>
                                                <p>&infin;</p>
                                            </div>
                                            <h4>Ellic</h4>
                                        </div>
                                    </a>
                                </div>
                            </div>

                            <div class="ui-block-c">
                                <div class="l-people" id="random_people_2">
                                    <a>
                                        <div class="l-avatar l-shadowbox" style="background-image:url('images/Stan.jpg')">
                                            <div class="l-status">
                                                <img src="images/online.png"/>
                                                <p>&infin;</p>
                                            </div>
                                            <h4>Stan</h4>
                                        </div>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </li>

                    <li>
                        <form action="login.php" method="post" id="login" data-ajax="false">
                            <div id="i_logintext">
                                <div id="i_logintext_l"></div>
                                <div id="i_logintext_r"></div>
                                <div id="i_icon1"></div>
                                <div id="i_label1">Email：</div>
                                <input type="email"  name="email" id="email" required="required"/>
                                <div id="i_icon2"></div>
                                <div id="i_label2">密  码：</div>
                                <input type="password" value="" name="password" id="password" required="required"/>
                                <input type="hidden" name="longitude" id="longitude" value="1" />
                                <input type="hidden" name="latitude" id="latitude" value="1" />
                            </div>
                            <p id="confirm"></p>

                            <div class="ui-grid-a" data-inline="true">
                                <div class="ui-block-a"><a data-role="button" href="#second"  data-icon="Star">注册</a></div>
                                <div class="ui-block-b"><input id="loginBtn" type="submit" value="登录"/></div>
                            </div>
                        </form>
                    </li>
                </ul>
            </div>

            <div id="neighbour_content" data-role="content" class="l-neighbour l-content" >
                <!-- Use ajax to load content-->

            </div>

            <div data-role="content" id="friend_content" class="l-content l-friend">
                <!--Use ajax to load content-->

                <ul data-role="listview" class="l-list" data-dividertheme="e">

                    <li class="l-friend-more">
                        <a>查看更多好友</a>
                    </li>
                </ul>
            </div>

            <div id="mine_content" data-role="content" class="l-content l-mine l-inset-content">
                <div id="tweet">
                    <ul id="tweet_list" class="l-inset l-detail l-profile-view " data-role="listview" data-inset="true">

                    </ul>
                </div>
                <div id="information">
                    <ul id="information_list" class="l-inset l-detail l-profile-view " data-role="listview" data-inset="true">

                    </ul>
                </div>
                <!--                <ul class="l-detail l-profile-view" data-role="listview" data-inset="true">
                                    Use ajax to load content
                                </ul>-->
            </div>

            <div data-role="footer" data-theme="b" data-position="fixed" id="index_footer" data-position="fixed">
                <div data-role="navbar">
                    <ul>
                        <li><a id="search_button" href="search.php" data-transition="slideup">搜索</a></li>
                        <li><a id="recommend_button" href="" data-transition="slideup">推荐</a></li>
                        <li><a id="logout_button" href="logout.php" data-ajax="false">登出</a></li>
                    </ul>
                </div>
            </div>

            <div data-role="footer" data-theme="b" data-backbtn="false" id="welcome_footer">
                <p style="text-align: center;font-size: 12px;" id="locationTip">定位中</p>
                <p style="text-align: center;font-size: 12px">© 2008-2011 team luff. All rights reserved.</p>
            </div>


        </div>
        <!-- 增加注册页面 -->
        <div data-role="page" id="second" data-theme ="c">
            <div data-role="header">
                <a data-role="button" data-icon="back" data-rel="back" >返回</a>
                <h5 class="header">注册Friend++</h5>
            </div>
            <div data-role="content">
                <form id="signup_form" action="register.php" method="post" data-ajax="false">
                    <div class="bg-r">

                        <div class="top_radius" id="a_list">
                            <div class="a_row">
                                <div class="a_name">Email：</div>
                                <input type="email"  name="email_input" class="a_text" id="email_input" required="required">
                            </div>
                            <div>
                                <span id="rigisterLoading"><img src="images/indicator.gif" alt="Checking" /></span>
                                <span id="rigisterResult"></span>
                            </div>
                            <div class="a_row">
                                <div class="a_name">密码：</div>
                                <input type="password" name="password_input" class="a_text a_text_default" id="password_input" required="required">
                            </div>
                            <div class="a_row a_last">
                                <div class="a_name">确认密码：</div>
                                <input type="password" name="password_confirm" class="a_text a_text_default" id="password_confirm">
                            </div>
                            <div data-role="fieldcontain">
                                <input type="hidden" name="longitude_register" id="longitude_register" value="1"/>
                                <input type="hidden" name="latitude_register" id="latitude_register" value="1" />
                            </div>
                            <div class="a_btn">
                                <!--<a class="a_btn_cancel" href="javascript:returnTo();">取 消</a>-->
                                <input type="submit" class="a_btn_ok" value="注册" id="rigisterBtn"/>  
                            </div>
                        </div><!-- a_list end -->

                    </div>

                </form>
            </div> 
            <div data-role="footer">
                <p style="text-align: center;font-size: 12px;"> © 2008-2011 team luff. All rights reserved. </p>
            </div>
        </div>
    </body>

</html>
